﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Google.GData.Client;
using Google.GData.Extensions;
using Google.GData.YouTube;
using Google.GData.Extensions.MediaRss;
using Google.YouTube;
using System.Text.RegularExpressions;
using System.Diagnostics;

namespace qna.pages
{
    public partial class Testing : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = "";
            string url = "jhghjgjkhhjkhttp://www.youtube.com/watch?v=72xSxQIRelc&amp;feature=youtube_gdataj,hlkj";
            Match youtubeMatch = YoutubeVideoRegex.Match(url);

            if (youtubeMatch.Success)
            {
                id = youtubeMatch.Groups[1].Value;
                Debug.Write(id);
            }

            
        }

        public Regex YoutubeVideoRegex = new Regex(@"youtu(?:\.be|be\.com)/(?:.*v(?:/|=)|(?:.*/)?)([a-zA-Z0-9-_]+)", RegexOptions.IgnoreCase);
    }
}